using UnityEngine;
using System.Collections;

public class Catcher : MonoBehaviour 
{
	public int moveSpeed = 60;
	
	// Use this for initialization
	void Start () 
	{
	
	}
	
	// Update is called once per frame
	void Update () 
	{
		Vector3 moveDirection = Vector3.zero;
		Vector3 newPosition = Vector3.zero;
		
		if(Input.GetKey(KeyCode.LeftArrow)) moveDirection.x -= 1;
		if(Input.GetKey(KeyCode.RightArrow)) moveDirection.x += 1;
		
		newPosition = moveDirection * (moveSpeed * Time.deltaTime);
		newPosition = transform.position + newPosition;
		newPosition.x = Mathf.Clamp(newPosition.x, -20, 20);
		
		transform.position = newPosition;
	}
}
